<!doctype html>
<html lang="en">
<head>

<?php include './inc/css.html'; ?>
<style type="text/css">


</style>
</head>

<body class="signin">
<?php include './inc/header.html'; ?>
<div class="wrap">
    <div class="signinpanel limit-width ">
        <div class="row">
            <div class="col-sm-7">
                <div class="signin-info">
                    <div class="logopanel">
                        <h1 class="logo lh10 tc ">[ 2025 ]</h1>
                    </div>
                    
                </div>
            </div>
            <div class="col-sm-5">
                <form >
                    <select class="form-control" id="schoolId" name="schoolId" value="">
                      <option value ="">请选择学校,注册后不可更改</option>
                    <?php for($i=1;$i<11;$i++){ ?>
                      <option value ="<?php echo $i; ?>"><?php echo '学校'.$i; ?></option>
                    <?php } ?>

                    </select>

                    <input type="text" class="form-control userName"  name="userName" placeholder="手机号" />
                    <input type="password" class="form-control password m-b" name="password" placeholder="密码" />
                    <input type="password" class="form-control password m-b" name="confirmPwd" placeholder="确认密码" />
                    <input type="number" id="yzcode" name="yzcode" class="form-control fl dn pc60"  placeholder="验证码">
                    <button type="button " id="yzbtn" class="btn btn-block btn-default fr dn pc33">验证码</button>
                    <button class="btn btn-block dib _bg_dark _text_teriary" id="registerbtn">注 册</button>
                    <div  class="lh4 tc _text_secondary"> 已有账号？ <a href="./login.php">立即登录&raquo;</a></div>
                </form>
            </div>
        </div>
        <div class="signup-footer">
            <div class="pull-left">
                &copy; 2025hr All Rights Reserved. 
            </div>
        </div>
    </div>
</div>

</body>
<?php include './inc/js.html'; ?>

<script type="text/javascript">
var time = 60;
$(document).ready(function(){
 $('#yzbtn').on('click',function(){
        layer.msg('验证码已发送,请注意查收');
        var that = $(this);
        that.attr('disabled',true);

        var count = setInterval(function(){
          if(time<=0){
            that.attr('disabled',false).text('重新获取');
             clearInterval(count);
             return;
          }

          that.text('('+time+'s)');
          time--;
        },1000)
    })




    $('#registerbtn').on('click',function(e){

        e.preventDefault();
        var userName = $.trim($('input[name=userName]').val());
        var password = $.trim($('input[name=password]').val());
        var confirmPwd = $.trim($('input[name=confirmPwd]').val());
        // var yzcode = $.trim($('input[name=yzcode]').val());
        var schoolId = $.trim($('#schoolId').val());


        if(userName.length==0||password.length==0||schoolId.length==0){
            layer.msg('请填写完整注册信息');
            return;
        }
        if(password!=confirmPwd){
            layer.msg('两次密码不一致');
            return;
        }
        // if(yzcode.length==0){
        //     layer.msg('请填写验证码');
        //     return;
        // }

        var data = {
            "schoolId":schoolId,
            "userName":userName,
            "password":$.md5(password),
            "confirmPwd":$.md5(confirmPwd),
            'yzcode':yzcode

        };


        // $.post('/index.php/WebApp/Users/toRegist',data ,function(result){
        //     var result = JSON.parse(result);
        //     if(!result.errcode){
        //         layer.msg(result.errmsg,{"time":1000});
        //     }else{
        //         layer.msg(result.errmsg,{"time":1000},function(){
        //           // 注册成功,跳转到登录页
        //           //window.location.href='';
        //         });
        //     }
        // })
        
        layer.msg('注册成功',{"time":1000}, function(){

            window.location.href ='./profile.php?left=fav&right=course';

        });
               
    })





    })

</script>
</html>